<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\api\AgentLoginController;
use App\Http\Controllers\api\NewHouseController;
use App\Http\Controllers\api\IndexController;
use App\Http\Controllers\api\OldHouseController;
use App\Http\Controllers\api\RentHouseController;
use App\Http\Controllers\api\AgentNewsController;
use App\Http\Controllers\api\AgentNoticeController;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    return $request->user();
});

//Su ang

Route::get('/index', [\App\Http\Controllers\api\InformationController::class, 'index']);
Route::get('/listIndex', [\App\Http\Controllers\api\InformationController::class, 'listIndex']);
Route::get('/fang', [\App\Http\Controllers\api\MapHouseController::class, 'index']);

//end Su ang

Route::group(['namespace' => 'Api', 'middleware' => ['JwtToken', 'throttle:60,1']], function () {
    Route::post('wxLogin', [AgentLoginController::class, 'wxLogin'])->withoutMiddleware('JwtToken');    //验证码登录
    Route::get('sendCode', [AgentLoginController::class, 'sendCode'])->withoutMiddleware('JwtToken');   //发送验证码
    Route::post('wxGrant', [AgentLoginController::class, 'wxGrant'])->withoutMiddleware('JwtToken');    //微信授权

    Route::get('newHouseAdd', [NewHouseController::class, 'newHouseAdd']);    //新房添加ES
    Route::post('newHouseSearch', [NewHouseController::class, 'newHouseSearch']);   //新房搜索

    Route::get('oldHouseAdd', [OldHouseController::class, 'oldHouseAdd']);    //二手房添加ES
    Route::post('oldHouseSearch', [OldHouseController::class, 'oldHouseSearch']);   //二手房搜索

    Route::get('rentHouseAdd', [RentHouseController::class, 'rentHouseAdd']);    //租房添加ES
    Route::post('rentHouseSearch', [RentHouseController::class, 'rentHouseSearch']);   //租房新房搜索
    Route::get('agentNewsList', [AgentNewsController::class, 'agentNewsList']);//消息列表
});
Route::group(['namespace' => 'Api', 'middleware' => ['JwtToken', 'throttle:60,1']], function () {
    Route::get('indexDo', [IndexController::class, 'indexDo'])->withoutMiddleware('JwtToken');      //登录获取用户昵称头像
    Route::get('newHouseList', [NewHouseController::class, 'newHouseList']);//新房列表
    Route::get('oldHouseList', [OldHouseController::class, 'oldHouseList']);//二手房列表
    Route::get('rentHouseList', [RentHouseController::class, 'rentHouseList']);//租房列表

    Route::get('agentNewsList', [AgentNewsController::class, 'agentNewsList']);//消息列表
    Route::post('agentNewsDelete', [AgentNewsController::class, 'agentNewsDelete']);//删除消息列表
    Route::get('agentNoticeList', [AgentNoticeController::class, 'agentNoticeList']);//公告列表
});

Route::middleware([])->group(function () {
    Route::post('login',[\App\Http\Controllers\api\LoginController::class,'login']);
    Route::get('getLocation',[\App\Http\Controllers\api\LoginController::class,'getUserLocation']);
    Route::get('slideshow',[\App\Http\Controllers\api\ClientHomePage::class,'getSlideshow']);
    Route::get('getArea',[\App\Http\Controllers\api\GetLocationController::class,'getArea']);
    Route::get('getHouses',[\App\Http\Controllers\api\GetLocationController::class,'getHouses']);
    Route::get('getHouse',[\App\Http\Controllers\api\HouseController::class,'getHouse']);
    Route::get('getHouseType',[\App\Http\Controllers\api\HouseController::class,'getHouseType']);
    Route::get('screenHouse',[\App\Http\Controllers\api\HouseController::class,'screenHouse']);
    Route::get('getBagRent',[\App\Http\Controllers\api\HouseController::class,'getBagRent']);
    Route::get('getInformation',[\App\Http\Controllers\api\ClientHomePage::class,'getInformation']);
});

Route::middleware(['JwtToken', 'throttle:60,1'])->group(function () {
    Route::post('upload',[\App\Http\Controllers\api\HousesCircle::class,'uploadFile']);
    Route::post('issue',[\App\Http\Controllers\api\HousesCircle::class,'issueDynamic']);
    Route::get('dynamicList',[\App\Http\Controllers\api\HousesCircle::class,'getDynamicList']);
    Route::get('deleteDynamic',[\App\Http\Controllers\api\HousesCircle::class,'deleteDynamic']);
    Route::get('collage/list',[\App\Http\Controllers\api\CollageController::class,'collageList']);
    Route::get('collage/detail',[\App\Http\Controllers\api\CollageController::class,'collageDetail']);
    Route::get('collage/info',[\App\Http\Controllers\api\CollageController::class,'collageInfo']);
    Route::post('collage/start',[\App\Http\Controllers\api\CollageController::class,'startCollage']);
    Route::get('collage/changeStatus',[\App\Http\Controllers\api\CollageController::class,'changeStatus']);
    Route::post('collage/create',[\App\Http\Controllers\api\CollageController::class,'createCollage']);
    Route::get('collage/deleteUser',[\App\Http\Controllers\api\CollageController::class,'deleteUser']);
    Route::get('collage/delete',[\App\Http\Controllers\api\CollageController::class,'deleteCollage']);
    Route::get('rank/list',[\App\Http\Controllers\api\BrokerRank::class,'brokerRankList']);
    Route::get('standing/well',[\App\Http\Controllers\api\StandingController::class,'getWellData']);
    Route::get('standing/rent',[\App\Http\Controllers\api\StandingController::class,'getRentData']);
});


Route::post('problem', [\App\Http\Controllers\api\Mine::class, 'problem']);
Route::get('myAnnounce', [\App\Http\Controllers\api\Mine::class, 'myAnnounce']);
Route::get('allLike', [\App\Http\Controllers\api\Mine::class, 'allLike']);
Route::get('history', [\App\Http\Controllers\api\Mine::class, 'history']);
Route::get('addHistory', [\App\Http\Controllers\api\Mine::class, 'addHistory']);

Route::get('rank',[\App\Http\Controllers\api\BrokerRank::class,'addRankData']);

Route::middleware(['JwtToken'])->group(function () {
    Route::get('getSign',[\App\Http\Controllers\api\TestController::class,'getUserSign']);
});
